package com.youhong.teethcare.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.youhong.teethcare.R;

/**
 * Created by Administrator on 2018/5/11 0011.
 */

public class DeviceNotScannedDialog extends Dialog implements View.OnClickListener {


    public DeviceNotScannedDialog(@NonNull Context context, Runnable runnable_refresh, Runnable runnable_skip, Runnable runnable_close) {
        this(context, R.style.dialog_device_not_scanned);
        run_refresh = runnable_refresh;
        run_skip = runnable_skip;
        run_close = runnable_close;
    }
    
    Runnable run_refresh, run_skip, run_close;
    Button btn_refresh, btn_skip;
    ImageView iv_close;

    public DeviceNotScannedDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        setContentView(R.layout.dialog_device_not_scanned);
        btn_refresh = findViewById(R.id.deviceNotFound_btn_refresh);
        btn_refresh.setOnClickListener(this);

        btn_skip = findViewById(R.id.deviceNotFound_btn_skip);
        btn_skip.setOnClickListener(this);

        iv_close = findViewById(R.id.deviceNotFound_iv_close);
        iv_close.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v == iv_close) {

            run_close.run();

        } else if (v == btn_skip) {

            run_skip.run();

        } else if (v == btn_refresh) {

            run_refresh.run();

        }

    }
}
